/*
 Navicat Premium Data Transfer

 Source Server         : local
 Source Server Type    : MySQL
 Source Server Version : 80029 (8.0.29)
 Source Host           : localhost:3306
 Source Schema         : flower

 Target Server Type    : MySQL
 Target Server Version : 80029 (8.0.29)
 File Encoding         : 65001

 Date: 23/09/2024 11:01:36
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_admins
-- ----------------------------
DROP TABLE IF EXISTS `t_admins`;
CREATE TABLE `t_admins` (
  `admin_id` int NOT NULL AUTO_INCREMENT,
  `admin_account` varchar(50) DEFAULT NULL,
  `admin_pwd` varchar(100) DEFAULT NULL,
  `real_name` varchar(50) DEFAULT NULL,
  `mobile` char(11) DEFAULT NULL,
  `del_flag` smallint DEFAULT NULL,
  PRIMARY KEY (`admin_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_admins
-- ----------------------------
BEGIN;
INSERT INTO `t_admins` (`admin_id`, `admin_account`, `admin_pwd`, `real_name`, `mobile`, `del_flag`) VALUES (1, 'admin', 'pmWkWSBCL51Bfkhn79xPuKBKHz//H6B+mY6G9/eieuM=', '系统管理员', '123456789', 0);
COMMIT;

-- ----------------------------
-- Table structure for t_categories
-- ----------------------------
DROP TABLE IF EXISTS `t_categories`;
CREATE TABLE `t_categories` (
  `cat_id` int NOT NULL AUTO_INCREMENT,
  `cat_name` varchar(10) DEFAULT NULL,
  `cat_desc` varchar(100) DEFAULT NULL,
  `del_flag` smallint DEFAULT NULL,
  PRIMARY KEY (`cat_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_categories
-- ----------------------------
BEGIN;
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (1, '春花', '春天开的花', 1);
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (2, '夏花', '夏天开的花', 1);
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (3, '秋花', '秋天开的花', 0);
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (4, '冬花', '冬天开的花', 0);
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (5, '观赏花', '好看', 0);
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (6, '药用花', '药用价值高', 0);
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (7, '香料花', '适合做香料', 0);
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (8, '夏花', '夏天开的花', 0);
INSERT INTO `t_categories` (`cat_id`, `cat_name`, `cat_desc`, `del_flag`) VALUES (9, '测试', '1', 1);
COMMIT;

-- ----------------------------
-- Table structure for t_customers
-- ----------------------------
DROP TABLE IF EXISTS `t_customers`;
CREATE TABLE `t_customers` (
  `cst_id` int NOT NULL AUTO_INCREMENT,
  `cst_mobile` char(11) DEFAULT NULL,
  `cst_pwd` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`cst_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_customers
-- ----------------------------
BEGIN;
INSERT INTO `t_customers` (`cst_id`, `cst_mobile`, `cst_pwd`) VALUES (1, '17663985133', '123456');
COMMIT;

-- ----------------------------
-- Table structure for t_food_categories
-- ----------------------------
DROP TABLE IF EXISTS `t_food_categories`;
CREATE TABLE `t_food_categories` (
  `cat_id` int NOT NULL,
  `food_id` int NOT NULL,
  PRIMARY KEY (`cat_id`,`food_id`),
  KEY `FK_cat_food` (`food_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_food_categories
-- ----------------------------
BEGIN;
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (7, 5);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (7, 6);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (7, 7);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (6, 8);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (3, 9);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (7, 9);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (3, 10);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (4, 10);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (3, 11);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (4, 11);
INSERT INTO `t_food_categories` (`cat_id`, `food_id`) VALUES (4, 12);
COMMIT;

-- ----------------------------
-- Table structure for t_food_details
-- ----------------------------
DROP TABLE IF EXISTS `t_food_details`;
CREATE TABLE `t_food_details` (
  `detail_id` int NOT NULL AUTO_INCREMENT,
  `food_id` int DEFAULT NULL,
  `img_path` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`detail_id`),
  KEY `FK_detail_foods` (`food_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_food_details
-- ----------------------------
BEGIN;
INSERT INTO `t_food_details` (`detail_id`, `food_id`, `img_path`) VALUES (1, 4, '2024_09_13/2024091318435099102.png');
INSERT INTO `t_food_details` (`detail_id`, `food_id`, `img_path`) VALUES (2, 4, '2024_09_13/2024091318435100503.png');
INSERT INTO `t_food_details` (`detail_id`, `food_id`, `img_path`) VALUES (3, 5, '2024_09_13/2024091319080481403.png');
INSERT INTO `t_food_details` (`detail_id`, `food_id`, `img_path`) VALUES (4, 5, '2024_09_13/2024091319080481402.png');
INSERT INTO `t_food_details` (`detail_id`, `food_id`, `img_path`) VALUES (5, 6, '2024_09_13/2024091319114683205.png');
INSERT INTO `t_food_details` (`detail_id`, `food_id`, `img_path`) VALUES (6, 7, '2024_09_13/2024091319145206702.png');
COMMIT;

-- ----------------------------
-- Table structure for t_food_tags
-- ----------------------------
DROP TABLE IF EXISTS `t_food_tags`;
CREATE TABLE `t_food_tags` (
  `food_id` int NOT NULL,
  `tag_id` int NOT NULL,
  PRIMARY KEY (`food_id`,`tag_id`),
  KEY `FK_tag_tag` (`tag_id`),
  CONSTRAINT `FK_tag_tag` FOREIGN KEY (`tag_id`) REFERENCES `t_tags` (`tag_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_food_tags
-- ----------------------------
BEGIN;
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (8, 1);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (9, 1);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (10, 1);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (11, 1);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (4, 2);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (10, 2);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (12, 2);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (5, 3);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (6, 3);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (7, 3);
INSERT INTO `t_food_tags` (`food_id`, `tag_id`) VALUES (8, 5);
COMMIT;

-- ----------------------------
-- Table structure for t_foods
-- ----------------------------
DROP TABLE IF EXISTS `t_foods`;
CREATE TABLE `t_foods` (
  `food_id` int NOT NULL AUTO_INCREMENT,
  `food_name` varchar(50) NOT NULL,
  `price` float DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `base_img` varchar(100) DEFAULT NULL,
  `del_flag` smallint DEFAULT NULL,
  `creator` int DEFAULT NULL,
  `create_date` datetime DEFAULT NULL,
  PRIMARY KEY (`food_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_foods
-- ----------------------------
BEGIN;
INSERT INTO `t_foods` (`food_id`, `food_name`, `price`, `remarks`, `base_img`, `del_flag`, `creator`, `create_date`) VALUES (10, '鲜花1', 22, '22', '2024_09_21/2024092123333428704.jpg', 0, 1, '2024-09-21 23:33:39');
INSERT INTO `t_foods` (`food_id`, `food_name`, `price`, `remarks`, `base_img`, `del_flag`, `creator`, `create_date`) VALUES (11, '鲜花1', 22, '22', '2024_09_21/2024092123333428704.jpg', 0, 1, '2024-09-21 23:33:39');
INSERT INTO `t_foods` (`food_id`, `food_name`, `price`, `remarks`, `base_img`, `del_flag`, `creator`, `create_date`) VALUES (12, '鲜花1', 22, '22', '2024_09_21/2024092123333428704.jpg', 0, 1, '2024-09-21 23:33:39');
COMMIT;

-- ----------------------------
-- Table structure for t_order_items
-- ----------------------------
DROP TABLE IF EXISTS `t_order_items`;
CREATE TABLE `t_order_items` (
  `order_id` int NOT NULL AUTO_INCREMENT,
  `food_id` int NOT NULL,
  `quantity` int DEFAULT NULL,
  `price` float DEFAULT NULL,
  PRIMARY KEY (`order_id`,`food_id`),
  KEY `FK_order_food` (`food_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_order_items
-- ----------------------------
BEGIN;
INSERT INTO `t_order_items` (`order_id`, `food_id`, `quantity`, `price`) VALUES (2, 10, 11, 22);
INSERT INTO `t_order_items` (`order_id`, `food_id`, `quantity`, `price`) VALUES (3, 10, 1, 22);
INSERT INTO `t_order_items` (`order_id`, `food_id`, `quantity`, `price`) VALUES (4, 10, 1, 22);
COMMIT;

-- ----------------------------
-- Table structure for t_orders
-- ----------------------------
DROP TABLE IF EXISTS `t_orders`;
CREATE TABLE `t_orders` (
  `order_id` int NOT NULL AUTO_INCREMENT,
  `cst_id` int DEFAULT NULL,
  `order_date` datetime DEFAULT NULL,
  `order_status` int DEFAULT NULL,
  `out_order_id` varchar(100) DEFAULT NULL,
  `total_price` float DEFAULT NULL,
  PRIMARY KEY (`order_id`),
  KEY `FK_order_cst` (`cst_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_orders
-- ----------------------------
BEGIN;
INSERT INTO `t_orders` (`order_id`, `cst_id`, `order_date`, `order_status`, `out_order_id`, `total_price`) VALUES (1, 1, '2024-09-22 22:37:35', 1, '1', 100);
INSERT INTO `t_orders` (`order_id`, `cst_id`, `order_date`, `order_status`, `out_order_id`, `total_price`) VALUES (2, 1, '2024-09-23 09:34:16', 1, '7262f380-5ce3-4d94-ac72-76f8ae4c9ab7', 22);
INSERT INTO `t_orders` (`order_id`, `cst_id`, `order_date`, `order_status`, `out_order_id`, `total_price`) VALUES (3, 1, '2024-09-23 09:34:36', 1, '8dae0e3b-7735-48a6-beea-cb5ffeba7a75', 22);
COMMIT;

-- ----------------------------
-- Table structure for t_tags
-- ----------------------------
DROP TABLE IF EXISTS `t_tags`;
CREATE TABLE `t_tags` (
  `tag_id` int NOT NULL AUTO_INCREMENT,
  `tag_name` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`tag_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_tags
-- ----------------------------
BEGIN;
INSERT INTO `t_tags` (`tag_id`, `tag_name`) VALUES (1, '今日特价');
INSERT INTO `t_tags` (`tag_id`, `tag_name`) VALUES (2, '店家主推');
INSERT INTO `t_tags` (`tag_id`, `tag_name`) VALUES (3, '本店热销');
INSERT INTO `t_tags` (`tag_id`, `tag_name`) VALUES (4, '万人回购');
INSERT INTO `t_tags` (`tag_id`, `tag_name`) VALUES (5, '美团优选');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
